<template>
  <div class="fly-panel fly-link">
    <h3 class="fly-panel-title">友情链接</h3>
    <dl class="fly-panel-main">
      <template  v-for="(item, index) in list">
        <dd :key="'links' + index">
          <a :href="item.link" target="_blank">{{ item.title }}</a>
        </dd>
        <dd :key="'links-empty' + index"></dd>
      </template>
    </dl>
  </div>
</template>

<script>
import { getLinks } from '@/api/content'
export default {
  name: 'links',
  data () {
    return {
      list: []
    }
  },
  created () {
    this.fetchLinks()
  },
  methods: {
    async fetchLinks () {
      try {
        const res = await getLinks()
        if (res.code === 200) {
          this.list = res.data
        }
      } catch (e) {
        console.log(e)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
